import request from '@/utils/request'

// 查询字典类型列表
export function listType(query) {
  return request({
    url: '/system/dict/type/list',
    method: 'get',
    params: query
  })
}

// 查询字典类型详细
export function getType(dictId) {
  return request({
    url: '/system/dict/type/' + dictId,
    method: 'get'
  })
}

// 新增字典类型
export function addType(data) {
  return request({
    url: '/system/dict/type',
    method: 'post',
    data: data
  })
}

// 修改字典类型
export function updateType(data) {
  return request({
    url: '/system/dict/type',
    method: 'put',
    data: data
  })
}

// 删除字典类型
export function delType(dictId) {
  return request({
    url: '/system/dict/type/' + dictId,
    method: 'delete'
  })
}

// 刷新字典缓存
export function refreshCache() {
  return request({
    url: '/system/dict/type/refreshCache',
    method: 'delete'
  })
}

// 获取字典选择框列表
export function optionselect() {
  return request({
    url: '/system/dict/type/optionselect',
    method: 'get'
  })
}


// 快码添加/快码详情添加
export function quickCodeAddApi(data) {
  return request({
    url: '/system/table',
    method: 'post',
    data: data
  })
}
// 快码列表
export function quickCodeListApi(data) {
  return request({
    url: '/system/table/parentNodes',
    method: 'get',
    params: data
  })
}
// 快码编辑/快码详情编辑
export function quickCodePutApi(data) {
  return request({
    url: '/system/table',
    method: 'put',
    data
  })
}
// 快码查询子集
export function quickCodeChildrenApi(data) {
  return request({
    url: '/system/table/children',
    method: 'get',
    params: data
  })
}
// 快码详情列表
export function quickCodeDetailListApi(data) {
  return request({
    url: '/system/table/nodeList',
    method: 'get',
    params: data
  })
}
//快码详请修改状态
export function quickCodeStatusApi(id,status) {
  return request({
    url: `/system/table/toggleStatus?id=${id}&status=${status}`,
    method: 'post',
  })
}